package Flap::Template::Filter;
use Flap qw/-b Flap::Object -m -s -w/;

sub commify {
    my($self, $r) = @_;
    $self->Util->commify($r) if ref($r) eq 'SCALAR';
    $r;
}

sub html {
    my($self, $r) = @_;
    $self->{T}->context->html($r) if ref($r) eq 'SCALAR' && !$self->{html}++;
    $r;
}

sub html_value {
    my($self, $r) = @_;
    $self->{T}->context->html_value($r) if ref($r) eq 'SCALAR' && !$self->{html}++;
    $r;
}

sub nvl {
    my($self, $r) = (shift, shift);
    $$r = shift if ref($r) eq 'SCALAR' && $$r eq '';
    $r;
}

sub raw {
    my($self, $r) = @_;
    $self->{raw} = 1;
    $r;
}

1;
